package views;

import javax.swing.table.TableCellRenderer;
import javax.swing.JPanel;
import javax.swing.JCheckBox;
import javax.swing.JTable;
import java.awt.Component;
import java.awt.BorderLayout;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class CheckTableCellRenderer implements TableCellRenderer
     {
         private JPanel panel=new JPanel();
         private JCheckBox checkBox= new JCheckBox();

         public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column)
         {
                Boolean v=(Boolean)value;
                if(v==null)
                {
                    v=false;
                }
                BorderLayout blayout=new BorderLayout();
                panel.setLayout(blayout);
                panel.add(checkBox,blayout.CENTER);
                checkBox.setSelected(v.booleanValue());
                return panel;
         }
     }
